{% extends 'IcsocUIBundle::page.html.twig' %}
{% from 'IcsocUIBundle:Macro:grid.html.twig' import gridWidth,gridNav,gridConfig,gridKeyword,sendKeyWord %}
{% block stylesheet %}
    {{ parent() }}
    {% stylesheets
    '@jqgird_css'
    '@gritter_css'
    filter='cssrewrite' filter='uglifycss'
    %}
    <link rel="stylesheet" href="{{ asset_url }}" />
    {% endstylesheets %}
{% endblock %}

{% block content %}
    {{ gridKeyword('Keyword'|trans, 'Support the relay number and the number of search'|trans, types) }}
    <table id="grid-table"></table>
    <div id="grid-pager"></div>
{% endblock %}
{% block footer %}
    {% javascripts
    '@jqgird_js'
    '@gritter_js'
    '@common_js'
    filter='uglifyjs'
    %}
    <script src="{{ asset_url }}"></script>
    {% endjavascripts %}
    <script type="text/javascript">
        var types = [];
        var BlackTypes = [];
        {% for key,type in types %}
            types[{{ key }}] = '{{ type }}';
        {% endfor %}
        {% for bkey,btype in black_types %}
            BlackTypes[{{ bkey }}] = '{{ btype }}';
        {% endfor %}

        jQuery(function($) {
            {{ gridWidth() }}
            jQuery(grid_selector).jqGrid({
                url: "{{ path('icsoc_namelist_black_list') }}",//数据；
                colNames:['id', '{{ 'Relay number'|trans }} ','{{ 'Number'|trans }}','{{ 'Black type'|trans }}', '{{ 'The number type'|trans }}','操作人','处理时间','备注'],  //列显示名称，是一个数组对象
                colModel:[
                    {name:'id',index:'id', hidden:true,editable: true, sortable:false},
                    {name:'trunk_num',index:'trunk_num',width:200, editable:true, sortable:false,formatter:function(cellvalue, options, rowObject){
                        return cellvalue.length < 1 ? '{{ 'all'|trans }}' : cellvalue;
                    }},
                    {name:'phone_num',index:'phone_num',width:200, editable:true, sortable:false },
                    {name:'call_type',index:'call_type',width:200, editable:true, sortable:false,formatter:function(cellvalue,options,rowobject){
                        return types[cellvalue] ? types[cellvalue] : '';
                    } },
                    {name:'black_type',index:'black_type',width:205, editable:true, sortable:false,formatter:function(cellvalue, options, rowObject){
                        return BlackTypes[cellvalue] ? BlackTypes[cellvalue] : '';
                    }},
                    {name:'handle_name',index:'handle_name',width:200, editable:true, sortable:false },
                    {name:'handle_time',index:'handle_time',width:200, editable:true, sortable:false },
                    {name:'remark',index:'remark',width:200, editable:true, sortable:false },
                ],
                {{ gridConfig() }}
                editurl: "{{ path('icsoc_namelist_black_opr') }}",//nothing is saved 定义对form编辑时的url
                caption: "{{ 'Black name list'|trans }}" //表格名称
            });
            {{ gridNav(false,false,true,false,true,true,path('icsoc_namelist_black_add')) }}
        });
        {{ sendKeyWord() }}
        $(document).ready(function(){
            $('#keyword').tooltip();
        })
    </script>
{% endblock %}